#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Widget)
{
    ui->setupUi(this);


}

Widget::~Widget()
{
    delete ui;
}

//向上，y-5
void Widget::on_button_up_clicked()
{

    QRect rect=ui->controled->geometry();
    //修改rec是直接去修改QRect
    rect.setY(rect.y()-5);
    ui->controled->setGeometry( rect);
    qDebug()<< rect;

}
//下
void Widget::on_button_down_clicked()
{
    QRect rect=ui->controled->geometry();
    //修改rec是直接去修改QRect
    rect.setY(rect.y()+5);
    ui->controled->setGeometry( rect);
    qDebug()<< rect;
}
//左
void Widget::on_button_left_clicked()
{

    QRect rect=ui->controled->geometry();
    //修改rec是直接去修改QRect
    rect.setX(rect.x()-5);
    ui->controled->setGeometry( rect);
    qDebug()<< rect;
}
//右
void Widget::on_button_right_clicked()
{
    QRect rect=ui->controled->geometry();
    //修改rec是直接去修改QRect
    rect.setX(rect.x()+5);
    ui->controled->setGeometry( rect);
    qDebug()<< rect;
}
